package com.leeon.typeinfo.example;

import java.lang.annotation.Annotation;
import java.lang.annotation.Documented;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Type;

import static net.mindview.util.Print.print;

public class Example20 {
	public static void main(String[] args) {
		if (args.length < 1)
			System.exit(0);
		Class<?> c = null;
		try {
			c = Class.forName(args[0]);
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
		for (Annotation a : c.getAnnotations())
			print(a);
		for (Constructor a : c.getConstructors())
			print(a);
		for (Field a : c.getFields())
			print(a);
		// for(Method a:c.getMethods())print(a);
		for (Class a : c.getClasses())
			print(a);
		for (Annotation a : c.getDeclaredAnnotations())
			print(a);
		for (Method m : c.getDeclaredMethods())
			print(m);
		for (Type t : c.getGenericInterfaces())
			print(t);
		print("c.isInterface(): " + c.isInterface());

		print("c.getTypeParameters(): " + c.getTypeParameters());
		print("c.isAnnotation(): " + c.isAnnotation());
		print("c.isAnnotationPresent(Documented.class): " + c.isAnnotationPresent(Documented.class));
		print("c.isAnonymousClass(): " + c.isAnonymousClass());
		print("c.isArray(): " + c.isArray());
		print("c.isAssignableFrom(Object.class): " + c.isAssignableFrom(Object.class));
		print("c.isEnum(): " + c.isEnum());
		print("c.isInstance(Object.class): " + c.isInstance(Object.class));
		print("c.isInterface(): " + c.isInterface());
		print("c.isLocalClass(): " + c.isLocalClass());
		print("c.isMemberClass(): " + c.isMemberClass());
		print("c.isPrimitive(): " + c.isPrimitive());
		print("c.isSynthetic(): " + c.isSynthetic());

	}
}
